
"use strict";
angular.module('app.granaryInfo').controller('ProjectinfoCtrl', function($scope,HTTPDataService,Auths){

 if(!Auths.getUser())
    {
         window.location.href=baseurls+"#/login";
    } 
     
   $scope.user = Auths.getUser();
   $scope.selectPanelShow = false;

   if($scope.user.role == "head")
      {
        $scope.selectPanelShow =  true; 
      }
 /*
    HTTPDataService.getGranaryProject_v().then(function(response) {
           $scope.granaryData = response;
    });
 */

    HTTPDataService.getSystemConfig().then(function(response){
       
        $scope.systemDate = response;
    });

    //配置分页基本参数
        $scope.paginationConf = {
            currentPage: 1,
            itemsPerPage: 10,
            pagesLength: 5,
            totalItems:20,
            perPageOptions: [10, 20, 30, 40, 50],
            onChange: function(){
            }
        };

        
     var GetAllEmployee = function () {
 
          HTTPDataService.getGranaryProject_v($scope.paginationConf).then(function (response) {
               
                $scope.paginationConf.totalItems = response['sum'];
                $scope.granaryData = response['content'];
               
            });
 
        }
 
        $scope.$watch('paginationConf.currentPage + paginationConf.itemsPerPage', GetAllEmployee);



});